package com.taxi.controller;

import com.taxi.response.AroundsearchResponse;
import com.taxi.response.PointResponse;
import com.taxi.result.Result;
import com.taxi.service.TerminalService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: aniu
 * @Date: 2023/9/30
 * @ClassName: TerminalController
 * @Description: Write class functionality and purpose here.
 * @Version: 1.0
 */
@RestController
@RequestMapping("/terminal")
public class TerminalController {
    @Autowired
    private TerminalService terminalService;

    /**
     *
     * @param name
     * @param desc 服务描述 非必填
     * @return
     */
    @ApiOperation("创建终端")
    @PostMapping("/add")
    public Result addTerminal(@RequestParam("name") String name,@RequestParam(value = "desc",required = false)String desc){
        return terminalService.add(name,desc);
    }

    @ApiOperation("周边搜索")
    @PostMapping("/aroundsearch")
    public Result aroundsearch(@RequestBody AroundsearchResponse aroundsearchResponse){
        return terminalService.aroundsearch(aroundsearchResponse);
    }

    @ApiOperation("轨迹查询")
    @PostMapping("/trsearch")
    public Result trsearch(@RequestParam String tid,@RequestParam Long starttime,@RequestParam Long endtime){
        return terminalService.trsearch(tid,starttime,endtime);
    }

    @ApiOperation("修改终端")
    @PostMapping("/update")
    public Result update(@RequestBody PointResponse pointResponse){
        return terminalService.update(pointResponse);
    }
}
